package BookService;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import dao.Ebook_entryMapper;
import pojo.Ebook_entry;

//此注解自动生成bean
@Service
public class Ebook_entryServiceImpl implements Ebook_entryService {
	
	//此注解自动注入bean
	@Resource
	private Ebook_entryMapper ebook;
	
	@Override  //限制查找，根据用户需求查找
	public List<Ebook_entry> getListBooks(int categoryId, int currentPageNo, int pageSize) {
		return ebook.getListBooks(categoryId, currentPageNo, pageSize);
	}

	@Override   //根据用户查询的分类编号来查询总条数，用于分页
	public int getConut(int categoryId) {
		return ebook.getConut(categoryId);
	}

	@Override  // 删除书本
	public boolean delBook(int categoryId) {
		return ebook.delBook(categoryId) > 0 ? true : false;
	}

	@Override   //增加书本
	public boolean addBook(Ebook_entry book) {
		return ebook.addBook(book) > 0 ? true : false;
	}

	@Override   //根据id查找书本 
	public Ebook_entry searchBook(String id) {
		return ebook.searchBook(id);
	}

	@Override   //修改书本信息
	public boolean modify(Ebook_entry e_book) {
		return ebook.modify(e_book) > 0 ? true : false;
	}

}
